<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
	<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> 
	<META HTTP-EQUIV="Expires" CONTENT="0"> 
	<title>投诉建议</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="../../css/font_eolqem241z66flxr.css" media="all" />
	<link rel="stylesheet" href="../../css/news.css" media="all" />
	<script src="../../layui/js/angular.js"></script>
	<script type="text/javascript" src="../../layui/layui/GetPath.js"></script>
	<script src="../../layui/layui/layui.js" charset="utf-8"></script>
	<script type="text/javascript" src="../../layui/js/fy.js"></script>
	<script type="text/javascript" src="../../layui/layui/layer.ext.js"></script>
	<script type="text/javascript" src="../../layui/lay/modules/layer.js"></script>
	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script>
		layui.use('form', function(){
			var form = layui.form();  
		});
	</script>
	<!-- JQuery 的遮罩层 -->
	<style type="text/css">     
    .mask {       
            position: absolute; top: 0px; filter: alpha(opacity=60); 
            z-index: 1002; left: 0px;              
			background:url(../../layui/layui/img/jz.gif) no-repeat center rgba(0,0,0,0.5) ;
		  	background-size:30px 30px;
			background-repeat: no-repeat;
			background: 
        }     
	</style>   
</head>
<body class="childrenBody">
	<form class="layui-form">
		<blockquote class="layui-elem-quote news_search">
			<div class="layui-inline">
				<select name="msgColl" id="tsjy">
					<option value="0">全部</option>
			        <option value="1">我的投诉</option>
					<option value="2">我的建议</option>
			    </select>
			</div>
			<div class="layui-inline">
					<a class="layui-btn search_btn" id="cx">查询</a>
					<a href="./tsAdd.html" class="layui-btn recommend" style="background-color:#5FB878">我要投诉</a>
					<a href="./JyAdd.html" class="layui-btn recommend" style="background-color:#888878">我要建议</a>
			</div>
		</blockquote>
	</form>
<div class="layui-form links_list" ng-app="myApp" ng-controller="customersCtrl">
	<div align="center" id="mask" class="mask"></div>  
	<div>
 			<loading>查询中请稍后</loading>
		<table class="layui-table msg_box" lay-skin="line" style="text-align: left;">
			<tr id="ts">
				<td style="color:#5FB878"><b>投诉</b></td>
				<td class="msg_info">
					<div  ng-repeat="x in names1">
						<p>{{x.FSRQ}}  {{x.JYR}}:{{x.ZW}}</p>
						<p  style="color:red;margin-left: 20px;" ng-if='x.HFZW!=null'>{{x.HFSJ}}  回复：{{x.HFZW}}</p>
					</div>
				</td>
				<td class="msg_opr" > <a ng-show="tsyc" href="./tsAdd.html" class="layui-btn layui-btn-mini reply_msg"><i class="layui-icon">&#xe611;</i> 继续提问</a></td>
			</tr>
			<tr id="jy">
				<td style="color:#5FB878"><b>建议</b></td>
				<td class="msg_info">
					<div  ng-repeat="c in names2">
						<p>{{c.FSRQ}}  {{c.JYR}}:{{c.ZW}}</p>
						<p  style="color:red;margin-left: 20px;" ng-if='c.HFZW!=null'>{{c.HFSJ}}  回复：{{c.HFZW}}</p>
					</div>
				</td>
				<td class="msg_opr"> <a ng-show="jyyc"  href="./JyAdd.html" class="layui-btn layui-btn-mini reply_msg" id="jxtw"><i class="layui-icon">&#xe611;</i> 继续提问</a></td>
			</tr>
		</table>
	</div>
</div> 
	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script type="text/javascript" src="message.js"></script>
	<script type="text/javascript" src="../../layui/layui/layui.js"></script>
	<script type="text/javascript" src="../../layui/layui/jquery-3.2.1.min.js"></script>
	<script type="text/javascript">
		function s(){     
        $("#mask").css("height",$(document).height());     
        $("#mask").css("width",$(document).width());     
        $("#mask").show();     
	    }  
	    //隐藏遮罩层  
	    function h(){     
	          
	        $("#mask").hide();     
	    }  
	</script>
	<script>
		layui.use('layer', function(){
  			var layer = layui.layer;
		});              
	</script>
	<script type="text/javascript" src="../../layui/layui/jquery-3.2.1.min.js"></script>
	<script>  
			var a;
			var app = angular.module('myApp', []);
		     app.directive('loading', function(){  
		        return {  
		            restrict: 'E',  
		            transclude: true,  
		            template: '<div ng-show="loading" class="loading" id="allDiv"  style="position:fixed; top:0px; left:0px; width:100%; height:100%; display:none; background-color:#000; opacity: 0.5; z-index:99999;">'  
		            +'<img alt="" src="../../layui/layui/img/jz.gif" style="vertical-align: middle;width:30px; height:30px; position: absolute; top:50%; left:50%; margin-top: -50px; margin-left:-50px;"/>'
		            +'</div>',  
		            link: function (scope, element, attr) {  
		                scope.$watch('loading', function (val) {  
		                    if (val){  
		                        document.getElementById("allDiv").style.display = "block";  
		                    }else{  
		                        document.getElementById("allDiv").style.display = 'none';  
		                    }  
		                });  
		            }  
		        };
		    });  
			    app.controller('customersCtrl', function($scope, $http) {
			    $scope.setLoading =function(){  
				    if($scope.loading ==undefined || $scope.loading ==false){  
				        $scope.loading=true;  
				    }else{  
				        $scope.loading=false;  
				    };
				};
		    
		    $("#cx").click(function(){
			var zt=$("#tsjy").val();
			if(zt=="0"){
				$scope.setLoading();
				$("#jy").show();
				$("#ts").show();			
				c1();
		    	c2();
		    	$scope.setLoading();
			}else if(zt=="1"){
				c1();
				$("#jy").hide();
				$("#ts").show();
			}else if(zt=="2"){
				c2();
				$("#jy").show();
				$("#ts").hide();
			}
		});
		    c1();
		    c2();
	function c1(){
		s();
			$http({
				url:getPath() + "/wsyyt/GRtsyjController/test1",
				method:'post',
				params:$scope.params
			}).then(
					function(res) {
					h();
								$scope.data1 = res.data.data;//自己打断点看格式:[{},{}]
								if($scope.data1[0].HFZW!="" && $scope.data1[0].HFZW!=null){
									$scope.tsyc=true;
								}
								
								
								
								$scope.pageSize = 20;//设置显示行数
      $scope.pages1 = Math.ceil($scope.data1.length / $scope.pageSize); //分页数
      $scope.pages=$scope.pages1;
      $scope.newPages = $scope.pages1 > 5 ? 5 : $scope.pages1;
      $scope.pageList = [];
      $scope.selPage = 1;
      //设置表格数据源(分页)
      $scope.setData= function () {
        $scope.names1 = $scope.data1.slice(($scope.pageSize * ($scope.selPage - 1)), ($scope.selPage * $scope.pageSize));//通过当前页数筛选出表格当前显示数据
      }
      $scope.names1 = $scope.data1.slice(0, $scope.pageSize);
      //分页要repeat的数组
      for (var i = 0; i < $scope.newPages; i++) {
        $scope.pageList.push(i + 1);
      }
      //打印当前选中页索引
      $scope.selectPage = function (page) {
      
        //不能小于1大于最大
        if (page < 1 || page > $scope.pages1) return;
      
        //最多显示分页数5
        if (page >2) {
          //因为只显示5个页数，大于2页开始分页转换
          var newpageList = [];
          for (var i = (page - 3) ; i < ((page + 2) > $scope.pages1 ? $scope.pages1 : (page + 2)) ; i++) {
            newpageList.push(i + 1);
          }
          $scope.pageList = newpageList;
        }
         else if (page ==1||page==2) {
          //因为只显示5个页数，大于2页开始分页转换
           if($scope.pages1>4){
          //因为只显示5个页数，大于\2页开始分页转换
          var newpageList = [];
          for (var i = 1 ; i < 6; i++) {
            newpageList.push(i);
          }
        }else{
         for (var i = 1 ; i < $scope.pages1+1; i++) {
            newpageList.push(i);
          }
          $scope.pageList = newpageList;
        };
        }
        $scope.selPage = page;
        $scope.setData();
        $scope.isActivePage(page);
        console.log("选择的页:" + page);
      };	
		});	
		}
		function c2() {
				s();
					$http({
				url:getPath() + "/wsyyt/GRtsyjController/jy1",
				method:'post',
				params:$scope.params
			}).then(
					function(res2) {
					h();
								$scope.data2 = res2.data.data;//自己打断点看格式:[{},{}]
								if($scope.data2[0].HFZW!="" && $scope.data2[0].HFZW!=null){
									$scope.jyyc=true;
								}
								
								if(res2.data.msg==null){
								 	layer.msg("登陆失效请重新登陆");
									setTimeout(function () {
										window.top.location.href=res.data;
									}, 1500);
									return;
								 
								}
								$scope.pageSize = 20;//设置显示行数
      $scope.pages2 = Math.ceil($scope.data2.length / $scope.pageSize); //分页数
      $scope.newPages = $scope.pages2 > 5 ? 5 : $scope.pages2;
      $scope.pageList = [];
      $scope.selPage = 1;
      //设置表格数据源(分页)
      $scope.setData= function () {
        $scope.names2 = $scope.data2.slice(($scope.pageSize * ($scope.selPage - 1)), ($scope.selPage * $scope.pageSize));//通过当前页数筛选出表格当前显示数据
      }
      $scope.names2 = $scope.data2.slice(0, $scope.pageSize);
      //分页要repeat的数组
      for (var i = 0; i < $scope.newPages; i++) {
        $scope.pageList.push(i + 1);
      }
      //打印当前选中页索引
      $scope.selectPage = function (page) {
      
        //不能小于1大于最大
        if (page < 1 || page > $scope.pages2) 
        return;
      
        //最多显示分页数5
        if (page >2) {
          //因为只显示5个页数，大于2页开始分页转换
          var newpageList = [];
          for (var i = (page - 3) ; i < ((page + 2) > $scope.pages ? $scope.pages : (page + 2)) ; i++) {
            newpageList.push(i + 1);
          }
          $scope.pageList = newpageList;
        }
         else if (page ==1||page==2) {
          //因为只显示5个页数，大于2页开始分页转换
          
         if($scope.pages2>4){
          //因为只显示5个页数，大于\2页开始分页转换
          var newpageList = [];
          for (var i = 1 ; i < 6; i++) {
            newpageList.push(i);
          }
        }else{
         for (var i = 1 ; i < $scope.pages2+1; i++) {
            newpageList.push(i);
          }
          $scope.pageList = newpageList;
        };
        }
        $scope.selPage = page;
        $scope.setData();
        $scope.isActivePage(page);
        console.log("选择的页:" + page);
      };

					});	
					}
				});				
		
	</script>
</body>
</html>